package com.jstyle.beatecg.activity;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Bundle;
import android.util.DisplayMetrics;
import com.jstyle.beatecg.R;
import com.jstyle.beatecg.base.BaseActivity;
import com.jstyle.beatecg.util.GlobalConast;
import com.jstyle.beatecg.util.SharePreferenceUtils;
import java.util.Locale;

public class SplashActivity extends BaseActivity {

    private Handler handler;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        String sta = SharePreferenceUtils.getSpString(SharePreferenceUtils.KEY_Language);
        if(null==sta){
            SharePreferenceUtils.setSpString(SharePreferenceUtils.KEY_Language, "en");
            // 本地语言设置
            Locale myLocale = new Locale("en");
            Resources res = getResources();
            DisplayMetrics dm = res.getDisplayMetrics();
            Configuration conf = res.getConfiguration();
            conf.locale = myLocale;
            res.updateConfiguration(conf, dm);
        }
        handler=new Handler();
       final boolean isFirst= SharePreferenceUtils.getSpBoolean(GlobalConast.KEY_isFirst);
       // final boolean isLogin= true;
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
               // startActivity(MainActivity.class);
                startActivity(isFirst?UserInfoSettingActivity.class:MainActivity.class);
                finish();
            }
        },1500);
    }

}
